﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using LowLevelGraphics;
using LowLevelGraphics.Histograms;

namespace ImageRecognition2.Forms
{
    public partial class FormStatistics : Form
    {
        protected UnsafeBitmap m_Bitmap = null;
        protected Statistics m_Statistics = null;

        /// <summary>
        /// 
        /// </summary>
        public FormStatistics()
        {
            InitializeComponent();

            this.Activated += delegate(object sender, EventArgs e)
            {
                ShowImageProperties();
            };

            this.Shown += delegate(object sender, EventArgs e)
            {
                ShowImageProperties();
            };
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="_image"></param>
        public FormStatistics(Image _image)
        {
            InitializeComponent();
            m_Bitmap = _image;
            m_Statistics = new Statistics(m_Bitmap);
            m_Bitmap.Dispose();
            ShowImageProperties();
        }

        /// <summary>
        /// Shows the image properties.
        /// </summary>
        protected void ShowImageProperties()
        {
            this.propertyGridStatistics.SelectedObject = m_Statistics;
            this.propertyGridStatistics.Update();
        }
    }
}
